package com.briup.demo.service.impl;

import com.briup.demo.bean.category;
import com.briup.demo.service.IcategoryService;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.util.List;


@Service
public class categoryServiceImpl implements IcategoryService {
    @Resource
    private com.briup.demo.dao.categoryMapper categoryMapper;


    @Override
    public List<category> findAll() {
     List<category>list=categoryMapper.selectAll();
        return list;
    }

    @Override
    public void saveOrUpdate(category category) {
        if (category.getId() != null) {
            categoryMapper.update(category);
        }
        else {
            categoryMapper.insert(category);
        }
    }

    @Override
    public void delete(Long id) {
    categoryMapper.delete(id);
    }
}
